Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How to share container screenshot in React Native | Expo for android

I have built an application where I want to share a component as an image. I am doing it like so.

 const shareImageHandler = async () => {
try {
  const uri = await captureRef(containerRef, {
    quality: 1,
    format: "jpg",
  });

  await Sharing.shareAsync(uri);
  console.log("action succeed");
} catch (error) {
  console.log("something went wrong!");
}

};

But I am getting this error.

[TypeError: undefined is not an object (evaluating '_expoSharing.default.shareAsync')]

the component that I want to share as an image.

 <ImageBackground
      ref={containerRef}
      source={{ uri: imgUrl ?? img() }}
      resizeMode="cover"
      style={styles.bgImg}
    >
      <View
        style={{
          width: "100%",
          height: "100%",
          position: "absolute",
          top: 0,
          left: 0,
          backgroundColor: "rgba(0,0,0,.7)",
        }}
      />
      <View style={styles.contentContainer}>
        <Text style={styles.quote}>&#8220; {content} &#8221;</Text>
        <Text style={styles.author}>&mdash;{data}</Text>
      </View>
    </ImageBackground>

I have tried many solutions but no one did the trick.

Note: I am able to save the component as an image in the gallery successfully, It is just a side note.

This application will be used only for android devices.

Thanks In advance.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You must be importing the lib wrong, the same happened to me, I was importing like this:

import Sharing from 'expo-sharing';

but the right way is this:

import * as Sharing from 'expo-sharing';
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!